/**
 * 
 */
package com.yidu.menuProject.service;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yidu.menuProject.action.vo.FoodAndCart;
import com.yidu.menuProject.dao.FoodModelMapper;
import com.yidu.menuProject.dao.KeepModelMapper;
import com.yidu.menuProject.model.FoodModel;
/**
 * 类的描述--
 * @author sylval
 * @date 2018年7月19日 上午11:27:41
 * @version 1.0
 */
@Service
public class KeepImpl implements KeepService{
	@Resource
	KeepModelMapper KeepDao;
	@Resource
	FoodModelMapper foodDao;
	/**
	 * 根据主键id查询
	 */
	public List<FoodAndCart> FindMessage(String cartId) {
		List<FoodAndCart> list = new ArrayList<FoodAndCart>();
		for(int i=0;i<cartId.split("_").length;i++){
			System.out.println(cartId.split("_")[i]+"购物车id");
			
			FoodModel food = foodDao.findMealId(cartId.split("_")[i]);
			FoodAndCart foodCart=KeepDao.FindMessage(cartId.split("_")[i]);
			
			System.out.println(foodCart.getFoodPrice()+"  "+foodCart.getFoodNum()+"    "+food.getMealId());
			foodCart.setFoodAllPrice(foodCart.getFoodPrice()*foodCart.getFoodNum());
			foodCart.setMealId(food.getMealId());
			list.add(foodCart);
		}
		return list;
	}
}
